/*
 * @Author: life 2145887855@qq.com
 * @Date: 2025-03-25 19:34:21
 * @LastEditors: life 2145887855@qq.com
 * @LastEditTime: 2025-04-07 21:41:21
 * @FilePath: \artist-platform-admin-master\src\api\td\student\index.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import request from '@/config/axios'

// 学生 VO
export interface StudentVO {
  id: number // 编号
  studentNo: string // 学号
  password: string // 密码
  mobile: string // 手机
  nickName: string // 艺名
  realName: string // 真实姓名
  birthday: Date // 生日
  gender: number // 性别
  incoming: Date // 入校时间
  qq: string // QQ
  headerPic: string // 头像
  studentState: number // 状态
  email: string // 邮件
  majorId: number // 专业编号
  classinfoId: number // 班级编号
}

// 学生 API
export const StudentApi = {
  // 查询学生分页
  getStudentPage: async (params: any) => {
    return await request.get({ url: `/td/student/page`, params })
  },

  // 查询学生详情
  getStudent: async (id: number) => {
    return await request.get({ url: `/td/student/get?id=` + id })
  },

  // 新增学生
  createStudent: async (data: StudentVO) => {
    return await request.post({ url: `/td/student/create`, data })
  },

  // 修改学生
  updateStudent: async (data: StudentVO) => {
    return await request.put({ url: `/td/student/update`, data })
  },

  // 删除学生
  deleteStudent: async (id: number) => {
    return await request.delete({ url: `/td/student/delete?id=` + id })
  },

  // 导出学生 Excel
  exportStudent: async (params) => {
    return await request.download({ url: `/td/student/export-excel`, params })
  },
  

 // 批量导入教师数据
  batchImportStudents: async (formData: FormData) => {
    return await request.post({
      url: `/td/student/batch-import`,
      data: formData,
      headers: { 'Content-Type': 'multipart/form-data' },
    });
  },

  // 下载学生模板 Excel
  exportStudentTemplate: async () => {
    return await request.download({ url: `/td/student/export-excel-template` })
  },
}
